home *** CD-ROM | disk | FTP | other *** search
/ Workbench Add-On / Workbench Add-On - Volume 1.iso / Dev / Oberon / source / amiga / Gadgets.mod < prev    next >
Text File  |  1995-06-29  |  6KB  |  211 lines

  1. (*************************************************************************
  2.  
  3.      $RCSfile: Gadgets.mod $
  4.   Description: Interface to the colorwheel, tapedeck and gradientslider
  5.                gadgets.
  6.  
  7.    Created by: fjc (Frank Copeland)
  8.     $Revision: 3.7 $
  9.       $Author: fjc $
  10.         $Date: 1995/06/04 23:13:14 $
  11.  
  12.   Includes Release 40.15
  13.  
  14.   (C) Copyright 1992-1993 Commodore-Amiga Inc.
  15.       All Rights Reserved
  16.  
  17.   Oberon-A Interface Copyright © 1994-1995, Frank Copeland.
  18.   This file is part of the Oberon-A Interface.
  19.   See Oberon-A.doc for conditions of use and distribution.
  20.  
  21. *************************************************************************)
  22.  
  23. <* STANDARD- *>
  24.  
  25. MODULE [2] Gadgets;
  26.  
  27. IMPORT SYS := SYSTEM, Kernel, e := Exec, u := Utility;
  28.  
  29. (* !!! ATTENTION !!!
  30.  * You have to call OpenColorWheel() and check it's result before
  31.  * using any of the colorwheel's procedures. The colorwheel is not
  32.  * opened automatically to save memory.
  33.  *)
  34.  
  35. (*
  36. **      $VER: gradientslider.h 39.1 (18.6.92)
  37. **
  38. **      Definitions for the gradientslider BOOPSI class
  39. *)
  40.  
  41. (************************************************************************)
  42.  
  43. CONST
  44.  
  45.   gradDummy *      = u.user + 005000000H;
  46.   gradMaxVal *     = gradDummy+1;  (* max value of slider         *)
  47.   gradCurVal *     = gradDummy+2;  (* current value of slider     *)
  48.   gradSkipVal *    = gradDummy+3;  (* "body click" move amount    *)
  49.   gradKnobPixels * = gradDummy+4;  (* size of knob in pixels      *)
  50.   gradPenArray *   = gradDummy+5;  (* pen colors                  *)
  51.  
  52.  
  53. (************************************************************************)
  54.  
  55. (*
  56. **      $VER: tapedeck.h 40.0 (12.3.93)
  57. **
  58. **      Definitions for the tapedeck BOOPSI class
  59. *)
  60.  
  61. (************************************************************************)
  62.  
  63. CONST
  64.  
  65.   tdeckDummy *     = u.user + 005000000H;
  66.   tdeckMode *      = tdeckDummy + 1;
  67.   tdeckPaused *    = tdeckDummy + 2;
  68.  
  69.   tdeckTape *      = tdeckDummy + 3;
  70.     (* (BOOL) Indicate whether tapedeck or animation controls.  Defaults
  71.      * to FALSE. *)
  72.  
  73.   tdeckFrames *    = tdeckDummy + 11;
  74.     (* (LONG) Number of frames in animation.  Only valid when using
  75.      * animation controls. *)
  76.  
  77.   tdeckCurrentframe * = tdeckDummy + 12;
  78.     (* (LONG) Current frame.  Only valid when using animation controls. *)
  79.  
  80. (************************************************************************)
  81.  
  82. CONST
  83.  
  84. (* Possible values for tdeckMode *)
  85.   butRewind *  = 0;
  86.   butPlay *    = 1;
  87.   butForward * = 2;
  88.   butStop *    = 3;
  89.   butPause *   = 4;
  90.   butBegin *   = 5;
  91.   butFrame *   = 6;
  92.   butEnd *     = 7;
  93.  
  94. (***********************************************************************)
  95.  
  96. (*
  97. **      $VER: colorwheel.h 39.2 (22.6.92)
  98. **
  99. **      Definitions for the colorwheel BOOPSI class
  100. *)
  101.  
  102. (***********************************************************************)
  103.  
  104. TYPE
  105.  
  106. (* For use with the WHEEL_HSB tag *)
  107.   ColorWheelHSBPtr * = POINTER TO ColorWheelHSB;
  108.   ColorWheelHSB * = RECORD
  109.     hue * : e.ULONG;
  110.     saturation * : e.ULONG;
  111.     brightness * : e.ULONG;
  112.   END;
  113.  
  114. (* For use with the WHEEL_RGB tag *)
  115.   ColorWheelRGBPtr * = POINTER TO ColorWheelRGB;
  116.   ColorWheelRGB * = RECORD
  117.     red * : e.ULONG;
  118.     green * : e.ULONG;
  119.     blue * : e.ULONG;
  120.   END;
  121.  
  122.  
  123. (***********************************************************************)
  124.  
  125. CONST
  126.  
  127.   wheelDummy *          = u.user + 004000000H;
  128.   wheelHue *            = wheelDummy+1;  (* set/get Hue               *)
  129.   wheelSaturation *     = wheelDummy+2;  (* set/get Saturation        *)
  130.   wheelBrightness *     = wheelDummy+3;  (* set/get Brightness        *)
  131.   wheelHSB *            = wheelDummy+4;  (* set/get ColorWheelHSB     *)
  132.   wheelRed *            = wheelDummy+5;  (* set/get Red               *)
  133.   wheelGreen *          = wheelDummy+6;  (* set/get Green             *)
  134.   wheelBlue *           = wheelDummy+7;  (* set/get Blue              *)
  135.   wheelRGB *            = wheelDummy+8;  (* set/get ColorWheelRGB     *)
  136.   wheelScreen *         = wheelDummy+9;  (* init screen/enviroment    *)
  137.   wheelAbbrv *          = wheelDummy+10; (* "GCBMRY" if English       *)
  138.   wheelDonation *       = wheelDummy+11; (* colors donated by app     *)
  139.   wheelBevelBox *       = wheelDummy+12; (* inside a bevel box        *)
  140.   wheelGradientSlider * = wheelDummy+13; (* attached gradient slider  *)
  141.   wheelMaxPens *        = wheelDummy+14; (* max # of pens to allocate *)
  142.  
  143.  
  144. (*-- Library Base variable --------------------------------------------*)
  145.  
  146. CONST
  147.  
  148.   colorWheelName * = "colorwheel.library";
  149.  
  150. VAR
  151.  
  152.   cwBase* : e.LibraryPtr;
  153.   cwOpenCount : LONGINT; (* OpenLib() counter *)
  154.  
  155.  
  156. (*-- Library Functions ------------------------------------------------*)
  157.  
  158. (*
  159. **      $VER: colorwheel_protos.h 39.1 (21.7.92)
  160. *)
  161.  
  162. (*--- functions in V39 or higher (Release 3) ---*)
  163.  
  164. (* Public entries *)
  165.  
  166. PROCEDURE ConvertHSBToRGB* [cwBase,-30]
  167.   ( VAR hsb [8] : ColorWheelHSB;
  168.     VAR rgb [9] : ColorWheelRGB );
  169.  
  170. PROCEDURE ConvertRGBToHSB* [cwBase,-36]
  171.   ( VAR rgb [8] : ColorWheelRGB;
  172.     VAR hsb [9] : ColorWheelHSB );
  173.  
  174. (*-- Library Base variable --------------------------------------------*)
  175.  
  176. <*$ LongVars- *>
  177.  
  178. (*-----------------------------------*)
  179. PROCEDURE* [0] CloseCW (VAR rc : LONGINT);
  180.  
  181. BEGIN (* CloseCW *)
  182.   IF cwBase # NIL THEN e.CloseLibrary (cwBase) END
  183. END CloseCW;
  184.  
  185. PROCEDURE [0] OpenColorWheel * (): BOOLEAN;
  186. BEGIN
  187.   IF cwOpenCount = 0 THEN (* not opened *)
  188.     cwBase := e.OpenLibrary(colorWheelName,39);
  189.   END;
  190.   IF cwBase # NIL THEN
  191.     INC(cwOpenCount);
  192.     RETURN TRUE;
  193.   END;
  194.   RETURN FALSE;
  195. END OpenColorWheel;
  196.  
  197. PROCEDURE [0] CloseColorWheel * ();
  198. BEGIN
  199.   IF cwOpenCount > 0 THEN
  200.     DEC(cwOpenCount);
  201.     IF cwOpenCount = 0 THEN
  202.       e.CloseLibrary(cwBase); cwBase := NIL;
  203.     END;
  204.   END;
  205. END CloseColorWheel;
  206.  
  207. BEGIN
  208.   cwOpenCount := 0; cwBase := NIL;
  209.   Kernel.SetCleanup (CloseCW)
  210. END Gadgets.
  211.